using B.S.XZYData.Api.Read.Application.Command.WorkTask;
using MediatR;
using Microsoft.AspNetCore.Mvc;

namespace B.S.XZYData.Api.Read.Controllers
{
    /// <summary>
    /// 任务控制器
    /// </summary>
    [ApiController]
    [Route("api/[controller]")]
    public class WorkTaskController : ControllerBase
    {
        private readonly IMediator _mediator;

        public WorkTaskController(IMediator mediator)
        {
            _mediator = mediator;
        }

        /// <summary>
        /// 分页查询任务
        /// </summary>
        /// <param name="command">查询命令</param>
        /// <returns>任务列表</returns>
        [HttpPost("query")]
        public async Task<IActionResult> QueryWorkTask([FromBody] QueryWorkTaskCommand command)
        {
            var result = await _mediator.Send(command);
            return Ok(result);
        }
    }
} 